package com;

import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

import java.time.Duration;

/**
 * @program: testcode01
 * @author: JCM
 * @create: 2023-10-17 21:48
 * @description:
 **/
public class AutoTest {
    public static ChromeDriver createDriver() {
        System.setProperty("webdriver.chrome.driver","C:\\Program Files\\Google\\Chrome\\Application\\chromedriver.exe");
        ChromeOptions options = new ChromeOptions();
        options.addArguments("--remote-allow-origins=*");
        ChromeDriver driver = new ChromeDriver(options);
        // 隐式等待一下，让页面渲染完成，防止找不到页面中的元素
        // 隐式等待作用于下面的整个作用域，这个方法中的所有元素，在三秒内不断轮询
//        driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(3));
        return  driver;
    }
}
